<script setup>
// 引入vue-router的Hooks
import { useRouter } from "vue-router";
const router = useRouter();
const skip = () => {
  // 执行跳转
  router.push({ path: "/login" });
};
</script>

<template>
  <div class="container">
    <h1>App</h1>
    <!-- 1.router-link类似与a标签的vue-router提供组件 -->
    <router-link to="/login">跳转登录</router-link>
    <router-link to="/home">跳转主页</router-link>
    <!-- 2.编程试跳转  js方式-->
    <a-spase>
      <a-button type="primary" @click="skip">点击跳转登录页</a-button>
      <a-button type="primary">点击跳转首页</a-button>
    </a-spase>
    <hr />
    <router-view></router-view>
  </div>
</template>

<style scoped></style>
